package com.example.bbs.controller;

import com.example.bbs.domain.model.ResponseResult;
import com.example.bbs.service.LikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 点赞接口
 */

@Controller
public class LikeController {

    @Autowired
    private LikeService likeService;

    /**
     * 点赞帖子
     * @param postId
     * @return
     */
    @PostMapping("/doLikePost")
    @ResponseBody
    public ResponseResult doLikePost(String postId) {
        return likeService.doLikePost(postId);
    }


    /**
     * 取消点赞帖子
     * @param postId
     * @return
     */
    @PostMapping("/undoLikePost")
    @ResponseBody
    public ResponseResult undoLikePost(String postId) {
        return likeService.undoLikePost(postId);
    }


    /**
     * 点赞评论
     * @param commentId
     * @return
     */
    @PostMapping("/doLikeComment")
    @ResponseBody
    public ResponseResult doLikeComment(String commentId) {
        return likeService.doLikeComment(commentId);
    }


    /**
     * 取消点赞评论
     * @param commentId
     * @return
     */
    @PostMapping("/undoLikeComment")
    @ResponseBody
    public ResponseResult undoLikeComment(String commentId) {
        return likeService.undoLikeComment(commentId);
    }


}
